﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using DAL;

namespace Bll
{
   public class DetailsCustomer
    {
        private string value_acno;//客户编号
        private string value_aeno;//经纪编号
        private string value_cName;//客户姓名
        private string value_eName;//客户英文名字
        private string value_passwd;//客户密码
       SpredInfoDAL sd = new SpredInfoDAL();

        public string AcNo
        {
            get
            {
                return value_acno;
            }
            set
            {
                value_acno = value;
            }
        }
       public string AeNo
        {
            get
            {
                return value_aeno;
            }
            set
            {
                value_aeno = value;
            }
        }


       public string CName
       {
           get
           {
               return value_cName;
           }
           set
           {
               value_cName = value;
           }
       }
       public string EName
       {
           get
           {
               return value_eName;
           }
           set
           {
               value_eName = value;
           }
       }

       public string Passwd
       {
           get
           {
               return value_passwd;
           }
           set
           {
               value_passwd = value;
           }
       }
     
       public DetailsCustomer()
       { 
       
       }

       public DataSet getDataSetSprit()
       {

          return  sd.getSprid();
       }

       public DetailsCustomer(string ac)
       {
         string sql = "select ac_no,ae_no,c_name,e_name,passwd from customer where ac_no='"+ac+"'";
         DataTable dataCustomer= GetDataTable(sql);
         if (dataCustomer.Rows.Count > 0)
         {
             this.AcNo = ac;
             if (dataCustomer.Rows[0]["ae_no"] != null)
             {
                 this.AeNo = dataCustomer.Rows[0]["ae_no"].ToString();
             }
             if (dataCustomer.Rows[0]["c_name"] != null)
             {
                 this.CName = dataCustomer.Rows[0]["c_name"].ToString();
             }
             if (dataCustomer.Rows[0]["e_name"] != null)
             {
                 this.EName = dataCustomer.Rows[0]["e_name"].ToString();
             }
             if (dataCustomer.Rows[0]["passwd"] != null)
             {
                 this.Passwd = dataCustomer.Rows[0]["passwd"].ToString();
             }
         }
       
       }
     
    
       public DataTable GetDataTable(string strSQL)
       {
           DataTable dttemp = null;
           try
           {
               dttemp = SqlHelper.ExecuteDatetable(SqlHelper.SQLConnectionString, strSQL);

           }
           catch (Exception ex)
           {
               ex.GetBaseException();           

           }
           return dttemp;
       }

    }
}
